package cn.anc.aonicardv.module.ui.my;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.Nullable;
import cn.anc.aonicardv.R;
import cn.anc.aonicardv.bean.LanguageSwitchBean;
import cn.anc.aonicardv.module.adpter.my.SwitchLanguageAdapter;
import cn.anc.aonicardv.module.ui.base.BaseActivity;
import cn.anc.aonicardv.util.ActivityUtils;

/**
 * Created by yangdai on 2017/12/5.
 */

public class SwitchPlayerActivity extends BaseActivity implements View.OnClickListener {
    private TextView titleTv;
    private ListView mLv;
    private SwitchLanguageAdapter mAdapter;
    private List<LanguageSwitchBean> mDataList = new ArrayList<>();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_switch_player);
        titleTv = (TextView) findViewById(R.id.tv_title);
        titleTv.setText("播放器选择");
        findViewById(R.id.tv_back).setOnClickListener(this);
        mLv = (ListView) findViewById(R.id.lv_switch_player);
        mAdapter = new SwitchLanguageAdapter(this);
        mLv.setAdapter(mAdapter);
        mLv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                int sPosition =   mAdapter.getSelectPosition();
                if (sPosition == position){
                    finish();
                    return;
                }
                setDefaultSelectLanguage();
                ActivityUtils.finishAll();
            }
        });
        LanguageSwitchBean bean = new LanguageSwitchBean();
        bean.setSelect(false);
        bean.setName("VlcPlayer");
        bean.setNameType("VlcPlayer");
        mDataList.add(bean);
        LanguageSwitchBean bean1 = new LanguageSwitchBean();
        bean1.setSelect(false);
        bean1.setName("IJKPlayer");
        bean1.setNameType("IJKPlayer");
        mDataList.add(bean1);
        setDefaultSelectLanguage();
    }

    @Override
    public void initVariable() {

    }

    @Override
    public void setListener() {

    }

    @Override
    public void initData() {
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tv_back:
                finish();
                break;
        }

    }


    private void setDefaultSelectLanguage() {

    }
}
